package  cc.vv.btpartyjob.partyservice.delegate

import android.widget.EditText
import android.widget.ImageView
import android.widget.TextView
import cc.vv.baselibrary.view.BaseTopBarView
import cc.vv.baselibrary.view.LKCircleImageView
import cc.vv.btpartyjob.partyservice.R
import cc.vv.mvp.delegate.BaseAppDelegate

/**
 * 添加志愿者托管类
 * Created by Chen.qi on 2018/10/24.
 */
class AddVolunteerActivityDelegate : BaseAppDelegate() {


    override fun initWidget() {
    }

    override fun initLayoutRes(): Int {
        return R.layout.activity_add_volunteer
    }

    /**设置标题title*/
    fun setTopBarTitle(topBarTitle: String) {
        val titleBar = getView<BaseTopBarView>(R.id.btv_addVo_topBar)
        titleBar?.setTitle(topBarTitle)
    }


    /**设置标题右边按钮点击事件*/
    fun setTitleBackBtnOnClick(event: BaseTopBarView.EventInterface) {
        val titleBar = getView<BaseTopBarView>(R.id.btv_addVo_topBar)
        titleBar?.setEventInterface(event)
    }

    /**获取头像控件*/
    fun getHeadPic(): LKCircleImageView {
        return getView(R.id.lkv_aadVo_headImg)
    }

    /**
     * 设置性别
     */
    fun selectedSex(isMan: Boolean) {
        val viewMan = getView<ImageView>(R.id.iv_addVo_man)
        val viewWoman = getView<ImageView>(R.id.iv_addVo_woman)
        if (isMan) {
            viewMan?.isSelected = true
            viewWoman?.isSelected = false
        } else {
            viewMan?.isSelected = false
            viewWoman?.isSelected = true
        }
    }

    /**
     * 获取名称
     */
    fun getVolunteerName(): String {
        val viewVolunteer = getView<EditText>(R.id.et_addVo_name)
        return viewVolunteer.text.toString().trim()
    }


    /**
     * 设置出生日期
     */
    fun setDataTime(time: String) {
        getView<TextView>(R.id.tv_addVo_birthDay)?.text = time
    }

    /**
     * 获取职业
     */
    fun getVolunteerZhiYe(): String {
        val viewVolunteer = getView<EditText>(R.id.et_addVo_zhiYe)
        return viewVolunteer.text.toString().trim()
    }

    /**
     * 获取个人特长
     */
    fun getVolunteerTeChang(): String {
        val viewVolunteer = getView<EditText>(R.id.et_addVo_geRenTeChang)
        return viewVolunteer.text.toString().trim()
    }

    /**
     * 获取联系方式
     */
    fun getVolunteerPhone(): String {
        val viewVolunteer = getView<EditText>(R.id.et_addVo_mobile)
        return viewVolunteer.text.toString().trim()
    }

    /**
     * 获取备注信息
     */
    fun getVolunteerRemarkInfo(): String {
        val viewVolunteer = getView<EditText>(R.id.et_addVo_remarkInfo)
        return viewVolunteer.text.toString().trim()
    }


    /**
     * 设置志愿时间
     */
    fun setVolunteerTime(time: String?) {
        val viewVolunteer = getView<TextView>(R.id.tv_addVo_volunteerTime)
        viewVolunteer?.text = time
    }

    /**
     * 设置志愿类型
     */
    fun setVolunteerType(type: String?) {
        val viewVolunteer = getView<TextView>(R.id.tv_aadVo_volunteerType)
        viewVolunteer?.text = type
    }


    /**
     * 设置志愿类型
     */
    fun setVolunteerDiQu(strAddress: String?) {
        val viewVolunteer = getView<TextView>(R.id.tv_addVo_suoShuDiQu)
        viewVolunteer?.text = strAddress
    }


}